.POSIX:
.RECIPEPREFIX = >
.DELETE_ON_ERROR:

MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules

SHELL ::= guix time-machine --channels=guix-env/channels.scm -- shell --check --manifest=guix-env/manifest.scm -- bash -c
.SHELLFLAGS = -Euxo pipefail -c

LIB_DIR ::= libs
GUILE_LOAD_PATH ::= .
GUILE_LOAD_PATH += $(LIB_DIR)

GUILE_LOAD_PATH_ARG ::= $(foreach dir, $(GUILE_LOAD_PATH),-L $(dir))

TEST_DIR ::= test


.PHONY: repl
repl:
> guile $(GUILE_LOAD_PATH_ARG)


.PHONY: shell
shell:
> bash


.PHONY: test
test:
> $(foreach \
	test_module, \
	$(wildcard $(TEST_DIR)/*), \
	guile $(GUILE_LOAD_PATH_ARG) $(test_module); \
  )
